package zozopo.manual;

import java.sql.Connection;
import java.util.List;


import zozopo.database.BusiDatabaseManager;
import zozopo.manual.operations.BrandlogoOS;
import zozopo.manual.operations.BrandlogoTB;
import zozopo.manual.operations.ReleaseOS;
import zozopo.manual.operations.ReleaseTB;
import zozopo.operations.comm.DictionaryOS;
import zozopo.operations.comm.DictionaryTB;


import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class LableAction extends ActionSupport implements Action {
	//传入参数
	private String lable;
	
	//分页参数
	private int beginPageNum = 0;
	private int pageSize = 20;
	private int rowNum = 0;
	
	//传回界面参数
	private String area;
	private List<ReleaseTB> releaseList;
	

	private List<BrandlogoTB> brandlogoList;
	private List<DictionaryTB> lablelist;
	


	public String execute(){
		BusiDatabaseManager databaseConnection = new BusiDatabaseManager();
		Connection conn = databaseConnection.getConnection();
		
	    ReleaseOS releaseOS = new ReleaseOS(conn);
	    
		DictionaryOS dictionaryOS = new DictionaryOS(conn);
		
		lablelist = dictionaryOS.getDictionaryLableList();
		area = dictionaryOS.getDictValue(lable);
		
		releaseList = releaseOS.selectNewByLable(lable, beginPageNum, pageSize);
 
		rowNum = releaseOS.getRowNumByLable(lable);
		databaseConnection.releaseConnection(conn);
		
		return SUCCESS;
	}
	
	public void validate() {
		// TODO Auto-generated method stub
		
	}
	
	public String getLable() {
		return lable;
	}

	public void setLable(String lable) {
		this.lable = lable;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	
	public int getBeginPageNum() {
		return beginPageNum;
	}

	public void setBeginPageNum(int beginPageNum) {
		this.beginPageNum = beginPageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public List<BrandlogoTB> getBrandlogoList() {
		return brandlogoList;
	}

	public void setBrandlogoList(List<BrandlogoTB> brandlogoList) {
		this.brandlogoList = brandlogoList;
	}


	public int getRowNum() {
		return rowNum;
	}

	public void setRowNum(int rowNum) {
		this.rowNum = rowNum;
	}
	
	public List<DictionaryTB> getLablelist() {
		return lablelist;
	}

	public void setLablelist(List<DictionaryTB> lablelist) {
		this.lablelist = lablelist;
	}
	
	public List<ReleaseTB> getReleaseList() {
		return releaseList;
	}

	public void setReleaseList(List<ReleaseTB> releaseList) {
		this.releaseList = releaseList;
	}
}
